package com.itheima.demo;

import com.itheima.domain.Orders;
import com.itheima.domain.User;
import com.itheima.mapper.UserMapper;
import com.itheima.utils.MapperUtil;

import java.util.List;

public class Demo {
    public static void main(String[] args) {
        UserMapper mapper = MapperUtil.getMapper(UserMapper.class);
        List<User> list = mapper.findAll();
        System.out.println(list.size());
        for (User user : list) {
            System.out.println("用户名:"+user.getUsername());
            //获取用户的订单集合
            List<Orders> ordersList = user.getOrdersList();
            for (Orders orders : ordersList) {
                System.out.println("订单编号:"+ orders.getNumber());
            }
        }
    }
}
